<?php
namespace app\admin\controller;

class Member extends Common
{
    private $obj;
    public function _initialize()
    {
        parent::_initialize();
        $this->obj = model('Member');
    }

    /**
     * 用户列表
     * @return \think\response\View
     */
    public function index()
    {
        $param = input('param.');
        $where = [];
        // 用户名
        if (isset($param['username']) && !empty($param['username'])) {
            $where['username'] = ['like', '%' . $param['username'] . '%'];
        }
        $data = $this->obj->order('id desc')->where($where)->paginate();
        $this->assign('data', $data);
        return view();
    }

    /**
     * 设置仓库管理员
     */
    public function save_warehouse_keeper() {
        $value = input('param.value');
        $id = input('param.id');
        $this->obj->save(['is_warehouse_keeper' => $value], ['id' => $id]);
        $this->success('设置成功');
    }
}
